
module CustomerServices (CtmService, CustomerServices, CustomerItem, emptyCtmServices, 
newCtmService, isEmptyCServices, newCustomer) where

import Customer

-- a customer service contains a haircute and a string representing additional notes
data CtmService = CtmService Haircut Notes

-- a customer with its services
data CustomerItem = CI Customer CustomerServices

type Notes = String
type Haircut = String

-- a wrapped storage structure that contains the customer services
newtype CustomerServices = CServices [CtmService]


-- creates a an empty customer service
newCtmService :: Haircut -> Notes -> CtmService
newCtmService hc notes = CtmService hc notes 


emptyCtmServices :: CustomerServices
emptyCtmServices = CServices []

isEmptyCServices :: CustomerServices -> Bool
isEmptyCServices (CServices []) = True
isEmptyCServices (CServices _) = False


addCtmService :: CustomerServices -> CtmService -> CustomerServices
addCtmService (CServices xs) cs = CServices (cs:xs)

-- Customer -> CustomerItem?
newCustomer :: Name -> CustomerItem
newCustomer name = CI (customer name) (emptyCtmServices)

-- persar una :: CustomerItem -> CtmService -> CustomerItem
addService :: CustomerItem -> Haircut -> Notes -> CustomerItem
addService (CI ctm services) hc nt = CI ctm (addCtmService services (CtmService hc nt))